/**
 * @author 
 * Yannic Remmet                        196983
 * Tobias Trabelsi                      197112
 * Anna-Katharina Wickert       197122
 */

import java.util.*;


public class MySet extends AbstractSet implements Set{

        public MySet(){
                content = new ArrayList();
        }
        
        public MySet(Object t){ 
               content = new ArrayList();
               content.add(t);
        }
        
        public ArrayList getContent() {
                return content;
        }
     

        public int size() {
            if (content == null){
                    return 0;
            }
            else
                    return content.size();
    }


        public String toString() {
                return content.toString();
        }


        public boolean add(Object o) { 
    		if(!contains(o) && o != null){
    			content.add(o);
    			return true;
    		}
    		return false;
        }


        public void clear() {
                content = new ArrayList();
                
        }

       

        public boolean contains(Object o) {
            return content.contains(o);
       }


		public boolean containsAll(Collection c) {
             return content.containsAll(c);
        }

        public boolean isEmpty() {
              return content.isEmpty();
        }

        public Iterator iterator() {
        	return content.iterator();
        }


        public boolean remove(Object o) {
        	return content.remove(o);
        }

        
        public boolean retainAll(Collection c) {
        	Iterator i = c.iterator();
        	ArrayList h = content;
        	content = new ArrayList();
        	Object o;
        	while(i.hasNext()){
        		o = i.next();
        		if (h.contains(o)){
        			add(o);
        		}
        	}
        	return true;
        }


        public Object[] toArray() {
                return content.toArray();
        }

        public boolean removeAll(Collection a) {
                return super.removeAll(a);
        }


        public Object[] toArray(Object[] a) {
        	a = toArray();
        	return a;
        }

        //data-elements
        private ArrayList content; 
}